package cn.javase.base.reflect;

import java.lang.reflect.Constructor;

public class _04_利用构造方法创建对象 {
    public static void main(String[] args) throws Exception {
        Class<Student> studentClass = Student.class;
        Constructor<Student> constructor = studentClass.getDeclaredConstructor(String.class);
        constructor.setAccessible(true); // 取消访问检查
        Student student = constructor.newInstance("张三");
        System.out.println(student);
    }
}
